package com.ambition.demo.design.proxy.service.impl;

import com.ambition.demo.design.proxy.service.OrderService;
import org.springframework.stereotype.Service;

/**
 * 静态代理模式
 * 业务需求，当有多个订单实现类时，需求添加需求计算每个方法运行的时间
 */

@Service
public class OderServiceImpl implements OrderService {
    @Override
    public void createOrder() {
        try {
            Thread.sleep(1234);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("创建订单");
    }

    @Override
    public void detail() {
        try {
            Thread.sleep(1234);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("查看订单");
    }

    @Override
    public void modify() {
        try {
            Thread.sleep(1234);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("修改订单");
    }
}
